<!DOCTYPE html>
<html>
  <head>
    <title>day16-demo1</title>
      <script src="../js/axios.min.js"></script>
  </head>
  <body>
    <div id="app">
      <input type="button" value="axios get5()" onclick="get5()"/>
    </div>
    <script>
        axios.defaults.baseURL="http://127.0.0.1:5000/"
        axios.defaults.headers.common['token']="besttest";
        function get5(){
          const form = new FormData()
          form.append("key","value")
          form.append("name","xiaowang")
          form.append("age",18)
          axios({
            url: "/user/data",
            method: "post",
            data: form
      }).then(response=>{
          console.log(response),
              console.log(response.data)
              const result=response.data
              alert(result)
              if(result.code===20000){
              alert("请求成功")
              }
              else {
                  alert("请求失败")
              }
          })
    }


    </script>
  </body>
</html>